home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Environments / PowerMacOberon feb96 / Text / Calc.Tool (.txt) < prev    next >
Encoding:
Oberon Text  |  1994-07-11  |  1.0 KB  |  28 lines  |  [.Ob./.Ob4]

  1. Syntax10.Scn.Fnt
  2. ParcElems
  3. Alloc
  4. LineElems
  5. Alloc
  6. Calc.Reset
  7. Calc.Set  alpha := 33H  beta := 1000H  ~
  8. Calc.List
  9. Calc.Hex alpha + beta
  10. Calc.Dec alpha^2 * 3
  11. Calc.Char "j" + 7
  12. Calc.Real cos (193 * pi)
  13. Oberon Desktop Calculator
  14. Warning:
  15.     Due to Texts scanner problems, a "-" should be
  16.     followed by a digit or a space to get proper results !
  17. Expression Syntax:
  18.     Expr = Term {AddOp Term}.
  19.     Term = Factor {MulOp Factor}.
  20.     Factor = Atom {PowOp Atom}.
  21.     Atom = Number | Functor Atom | ident | "(" Expr ")".
  22.     PowOp = "^".
  23.     MulOp = "*" | "/" | "%" | "<" | ">".    -- % modulo, < shift left, > shift right
  24.     AddOp = ["+" | "-"].    -- no add op: addition(!)
  25.     Number = (digit {digit}) | (digit {hexDigit} "H") | (digit {hexDigit} "X") | (""" char """).
  26.     Functor = "arccos" | "arcsin" | "arctan" | "cos" | "entier" | "exp" | "ln" | "short" | "sign" | "sin" | "sqrt" | "tan".
  27. All operators except for "^" are left-associative; "^" is right-associative.
  28.